<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="target-densitydpi=device-dpi,width=device-width,initial-scale=1,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"/>
    <title>system</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
            width: 100%;
        }

        body {
            background: transparent;
            color: #666;
            height: 100%;
            position: relative;
            width: 100%;
        }

        li {
            list-style: none;
        }

        a {
            text-decoration: none;
            outline: none;
            background-color: transparent;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }

        a:focus, input:focus {
            outline: none;
            background-color: transparent;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }

        img, a:focus img {
            border: none;
            outline: none;
        }

        .hide {
            display: none;
        }

        .clr {
            clear: both;
        }

        ::-webkit-input-placeholder {
            color: #fff;
        }

        .container {
            width: 1180px;
            height: 196px;
            margin: 0 -590px;
            font-size: 12px;
            background: transparent;
            text-align: center;
            position: absolute;
            left: 50%;
            overflow: hidden;
        }

        .container img {
            width: 1180px;
            height: 196px;
            background: transparent;
            display: block;
        }

        /*长虹呼出提示公共css add by xyw 20160722 start */
        .etvtips {
            position: absolute;
            left: 80px;
            bottom: 40px;
            width: 440px;
            height: 140px;
            background: url("etvbg.png") no-repeat;
        }

        .etvtips .logo {
            border: 0;
            display: block;
            height: 140px;
            outline: none;
            width: 140px;
            position: absolute;
            top: 20px;
            left: 25px;
        }

        .etvtips .logo img {
            border: 0;
            width: 100px;
        }

        .etvtips .er {
            position: absolute;
            left: 150px;
            top: 25px;
            width: 240px;
            height: 90px;
            overflow: hidden;
        }

        .etvtips .er .h2 {
            text-align: center;
            width: 240px;
            height: 60px;
            line-height: 30px;
            font-size: 22px;
            color: #fff;
            position: absolute;
            left: 0;
            bottom: 30px;
            display: block;
            overflow: hidden;
        }

        .etvtips .er span {
            font-size: 14px;
            color: #b0ef0d;
            position: absolute;
            left: 0;
            bottom: 0;
            display: block;
        }

        /*长虹呼出提示公共css add by xyw 20160722 end */

        @media only screen and (min-width: 880px) and (max-width: 1179px) {
            .container {
                -webkit-transform: scale(0.75);
                bottom: 0;
            }

            .etvtips {
                -webkit-transform: scale(0.5);
                bottom: -15px;
                left: -100px;
                background: url("etvbg.png") no-repeat left center;
            }
        }

        @media only screen and (min-width: 1180px) and (max-width: 1719px) {
            .container {
                -webkit-transform: scale(1);
                bottom: 10px;
            }
        }

        @media only screen and (min-width: 1720px) {
            .container {
                -webkit-transform: scale(1.5);
                bottom: 70px;
            }
        }
    </style>

    <script src="jquery-v1.10.2-mini.js"></script>
    <script src="md5-mini.js"></script>

    <script>
        var purls = [];
        var murls = [
            'http://monitor.ads.huan.tv/service/requestLe/monitor?jcnum=AD_app-BANNER_TCL_C2S_1535016575497&lab=__LAB__&ip=__IP__&time=__TIME__&dra=__DRA__&dnum=__DNUM__&mac=__MAC__&mac1=__MAC1__&mdid=__MDID__&dev=__DEVID__&pid=__PID__&mid=__MID__&err=__ERR__',
            'http://urls.cedock.com/static?jcnum=AD_app-BANNER_TCL_C2S_1535016575497&lab=__LAB__&ip=__IP__&time=__TIME__&dra=__DRA__&dnum=__DNUM__&mac=__MAC__&mac1=__MAC1__&mdid=__MDID__&dev=__DEVID__&pid=__PID__&mid=__MID__&err=__ERR__',
        ];
    </script>
</head>
<body>
<!--广告曝光开始-->
<div id="advload" style="display:none"></div>
<!--这个是呼出提示加载之后或者说创意呼出之后就曝光-->


<!--广告曝光结束-->
<div class="etvtips hide" id="tips">
    <div class="logo"></div>
    <div class="er">
        <span class="h2">更多精彩等您加入！</span>
        <span id="test">“确认”键进入,“返回”键退出</span>
    </div>
</div>

<div class="container hide" id="maininit"><img src="bgtm.png"><span id="debug"></span></div>
<script>
    var tips = {
        isshow: '1',
        state: '0',
        times: 10000,
        isforce: ''
    };

    var GP = {
        times: 30,
        cid: '5b7e4ab6272e26df6b8eae1c',
        cname: '自定义单图测试',
        ctype: 'picbase',
        bsType: '',
        mac: '',
        macmd: '',
        reporturls: 'http://www2.cmsetv.huan.tv/report.html?cid=5b33682c272e2657218b46f3',
        apk_tips_isshow: '',
        uac: 'http://analysis4tvmars.huan.tv/userBehavior4TVMars/userActionCollectServlet',

        init: function () {
            var bsif = GP.get('bstypeisforce');
            if (bsif.length > 1) {
                tips.isforce = bsif.charAt(0);
                for (i = 1; i < bsif.length; i++)GP.bsType += bsif.charAt(i);
            }
            GP.apk_tips_isshow = GP.get('apk_tips_isshow');
            GP.ua = GP.get('useragent');
            GP.report(1);
            GP.macmd = GP.md5mac(GP.mac);
            setTimeout("GP.reporturl()", 100);
            setTimeout("GP.thridshow()", 50);
            //告诉安卓apk30秒后执行GP.close↓
            if (typeof strongtv != 'undefined') {
                window.strongtv.controlKeyCode(4, true, 'GP.close()');
            }
            //告诉安卓apk30秒后执行GP.close↑

            var acts = '';

            if (!(tips.isforce == '' && GP.apk_tips_isshow == '' )) {
                acts = ( tips.isforce == '1' || GP.apk_tips_isshow == '0' ) ? 2 : 1;
                if (acts == 2 && tips.isshow == 1) tips.isshow = 0;
            } else {
                acts = ( tips.isshow == 1 ) ? 2 : 1;
            }

            var st = '5' * 1000;
            if (st)tips.times = st;
            if (tips.isshow == '1' && tips.isforce == '0') {
                $('#tips').show();
                GP.tipstimer = setTimeout(tips.isforce == '1' ? 'GP.showinit()' : 'GP.close()', tips.times);
            } else {

                GP.showinit();
            }
        },
        reporturl: function () {
            ajax.get({url: GP.reporturls + '&tim=' + GP.tim() + '&useraget=' + GP.ua});
        },
        showinit: function () {
            tips.state = '1';
            GP.report(2);
            $('#tips').hide();
            if (tips.isshow == '1') {
                clearTimeout(GP.tipstimer);
            }
            $('#maininit').show();
            GP.exposure();
            return false;
        },
        close: function () {
            //调用安卓apk的内置方法↓
            if (typeof strongtv != 'undefined') {
                window.strongtv.exitWidow();
            }
            //调用安卓apk的内置方法↑
        },
        keydown: function (e) {
            var key = e.keyCode;
            //监听用户是否按了返回退出键如果是则退出↑
            if (tips.isshow == '1' && tips.state == '0' && key == 13) {
                $.ajax({
                    type: 'POST',
                    url: 'http://www2.cmsetv.huan.tv/?act=report&cid=5b33682c272e2657218b46f3&useragent=' + GP.ua,
                    data: {step: 'w'},
                    dataType: 'json',
                    success: function (msg) {
                    }
                });
                return GP.showinit();
            }
        },
        exposure: function () {
            for (i = 0; i < purls.length; i++) {
                var s = purls[i];
                if (GP.mac != '') {
                    s = s.replace('__MAC__', GP.macmd)
                }
                ajax.get({url: s});
            }
        },
        thridshow: function () {
            for (i = 0; i < murls.length; i++) {
                var s = murls[i];
                if (GP.mac != '') {
                    s = s.replace('__MAC__', GP.macmd);
                }
                ajax.get({url: s});
            }
        },
        md5mac: function (mac) {
            var m = mac.replace(/:/g, '');
            m = m.replace(/-/g, '');
            m = m.toUpperCase();
            m2 = hex_md5(m);
            m3 = m2.toUpperCase();
            return m3;
        },
        report: function (acts) {
            GP.Arr = GP.ua.split("|");
            if (GP.Arr.length < 5)return;
            GP.mac = GP.Arr[2];
            var data = 'ver=1.0.41';
            data += '&deviceid=' + GP.Arr[5];
            data += '&source=' + GP.Arr[3];
            data += '&software=' + GP.Arr[4];
            data += '&createtime=';
            data += '&clienttype=' + GP.Arr[6];
            data += '&entitytype=' + GP.Arr[7];
            data += '&mac=' + GP.Arr[2];
            data += '&dnum=' + GP.Arr[8];
            data += '&os=' + GP.Arr[15];
            data += '&resolution=' + GP.Arr[16];
            data += '&huanid=' + GP.Arr[17];
            data += '&netstats=' + GP.Arr[18];
            data += '&manufacturer=' + GP.Arr[19];
            data += '&hversion=' + GP.Arr[20];
            data += '&sversion=' + GP.Arr[21];
            data += '&channel=' + GP.Arr[22];
            data += '&ip=';
            data += '&data=creative,{';
            data += (GP.Arr[14] == '') ? ' ' : GP.Arr[14];
            data += ',' + (GP.Arr[9] == '' ? ' ' : GP.Arr[9]);
            data += ',' + (GP.Arr[10] == '' ? ' ' : GP.Arr[10]);
            data += ',' + (GP.Arr[11] == '' ? ' ' : GP.Arr[11]);
            data += ',' + (GP.bsType == '' ? ' ' : GP.bsType);
            data += ',' + (GP.Arr[13] == '' ? ' ' : GP.Arr[13]);
            data += ',' + GP.cid;//isset($a['cid'])?$a['cid']:' ');
            data += ',' + GP.cname;//isset($a['cname'])?$a['cname']:' ');
            data += ',' + GP.ctype;//isset($a['ctype'])?$a['ctype']:' ');
            data += ',' + acts;//isset($a['acts' ])?$a['acts' ]:' ').',[';
            data += ',[ ], ';
            data += ',' + GP.Arr[23];
            data += '}';
            GP.datas = (data);
            console.log(GP.datas);
            ajax.post({url: GP.uac, data: GP.datas});
        },
        get: function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return decodeURI(r[2]);
            return '';
        },
        tim: function () {
            var d = new Date();
            var ret = '' + d.getFullYear();
            var m = d.getMonth() + 1;
            ret += '' + ( (m > 9) ? m : '0' + m);
            var h = d.getDate();
            ret += '' + ( h > 9 ? h : '0' + h );
            ret += '' + d.getHours();
            var min = d.getMinutes();
            ret += min < 30 ? '00' : '30';
            return ret;
        }
    };
    window.onload = GP.init;
    window.onkeydown = GP.keydown;


    var ajax = {
        i: 0,
        xmlhttp: null,
        init: function () {
            ajax.xmlhttp = new XMLHttpRequest();
        },
        get: function (obj) {
            if (typeof obj.url != 'undefined')ajax.url = obj.url;
            if (typeof obj.callback != 'undefined')ajax.callback = obj.callback;
            try {
                xmlhttp = new XMLHttpRequest();
                xmlhttp.onreadystatechange = function () {
                };
                xmlhttp.open('GET', ajax.url);
//                xmlhttp.setRequestHeader('User-Agent',"smarty&&");
                xmlhttp.send(null);
            } catch (err) {
                console.log(err)
            }
        },
        post: function (obj) {
            if (typeof obj.url != 'undefined')ajax.url = obj.url;
            if (typeof obj.data != 'undefined')ajax.data = obj.data;
            if (typeof obj.callback != 'undefined')ajax.callback = obj.callback;
            ajax.init();
            ajax.dataType = 'json';
            ajax.xmlhttp.onreadystatechange = ajax.result;
            ajax.xmlhttp.open('post', ajax.url);
            ajax.xmlhttp.send(ajax.data);
        },
        result: function () {
            if (ajax.xmlhttp.readyState == 4) {
                ajax.i++;
                console.log(ajax.i + ".status=" + ajax.xmlhttp.status);
                if (ajax.xmlhttp.status == 200) {
                    ajax.retmsg = ajax.xmlhttp.responseText;
                    if (ajax.dataType == 'json') {
                        ajax.retmsg = eval('(' + ajax.retmsg + ')');
                    }
                    ajax.callback(ajax.retmsg);
                } else {
                    ajax.error(ajax.xmlhttp.status);
                }
            }
        },
        callbback: function (msg) {
        },
        error: function (code) {
        }
    };
</script>
<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?8d3407a119439a892e462759f06e7591";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
</html>
